package by.admonko.universaltesting.services.impl;

import java.util.List;

import javax.inject.Inject;

import org.springframework.stereotype.Service;

import by.admonko.universaltesting.dataaccess.UserGroupDao;
import by.admonko.universaltesting.datamodel.UserGroup;
import by.admonko.universaltesting.services.UserGroupService;

@Service
public class UserGroupServiceImpl implements UserGroupService {
	@Inject
	UserGroupDao groupDao;

	@Override
	public UserGroup getGoup(Integer id) {
		return groupDao.getById(id);
	}

	@Override
	public void setGroup(UserGroup userGroup) {
		groupDao.insert(userGroup);

	}

	@Override
	public void updateGroup(UserGroup userGroup) {
		groupDao.update(userGroup);

	}

	@Override
	public void removegroup(Integer id) {
		groupDao.delete(id);
	}

	@Override
	public void removeAllGroups() {
		groupDao.deleteAll();

	}

	@Override
	public List<UserGroup> getAllGroups() {

		return groupDao.getAll();
	}
}
